package Day4Zuoye;

public class Shopping {
     String name;
     String address;
     int pos;
     Viper []vipers=new Viper[100];
     public boolean add(Viper viper){
         if (pos >=vipers.length ) {
             System.out.println("人已经满了!");
             return false;
         } else {
             for (int i = 0; i < pos; i++) {
                 if (vipers[i].equals(viper)) {
                     return true;
                 }
             }
             vipers[pos++] =viper ;
         }
         return false;
     }

   public boolean inc(String num,int jifen){
       for (int i=0;i<pos;i++){
           if (vipers[i].num.equals(num)){
               vipers[i].jifen+=jifen;
               return true;
           }
       }
             return false;
    }

    public boolean checkCardNoRepeat(String num){
        for (int i = 0; i < pos; i++) {
            if (vipers[i].num.equals(num)) {
                System.out.println("会员号已重复");
                return true;
            }
        }
        return false;
     }


    public void show(){
        System.out.println(name+"商场在"+address);
    }

    public Shopping() {
    }

    public Shopping(String name, String address,int pos) {
        this.name = name;
        this.address = address;
        this.pos = pos;
    }

}
